<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<title>{{ $_ENV['SYSTEM_TITLE'] }}</title>
	<meta name="description" content="particles.js is a lightweight JavaScript library for creating particles.">
	<meta name="author" content="Vincent Garreau" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
	<link rel="shortcut icon" href="/img/favicon.ico"/>
	<link rel="stylesheet" media="screen" href="{{ asset('/css/style.css') }}">
	<link rel="stylesheet" type="text/css" href="{{ asset('/css/reset.css') }}"/>
	<link rel="stylesheet" type="text/css" href="{{ asset('/css/AdminLTE.min.css') }}"/>
	<link rel="stylesheet" type="text/css" href="{{ asset('/css/bootstrap.min.css') }}"/>
	<script src="{{ asset('/js/jquery.min.js') }}"></script>
</head>
<body>

<div id="particles-js">
	<div class="login">
		<div class="login-top">
			{{ $_ENV['SYSTEM_NAME'] }}登录
		</div>
		<div class="login-center clearfix">
			<div class="login-center-img"><img src="/img/name.png"/></div>
			<div class="login-center-input">
				<input type="text" name="username" value="" placeholder="请输入您的用户名" onfocus="this.placeholder=''" onblur="this.placeholder='请输入您的用户名'" required maxlength="11" />
				<div class="login-center-input-text">用户名</div>
			</div>
		</div>
		<div class="login-center clearfix">
			<div class="login-center-img"><img src="/img/password.png"/></div>
			<div class="login-center-input">
				<input type="password" name="password" value="" placeholder="请输入您的密码" onfocus="this.placeholder=''" onblur="this.placeholder='请输入您的密码'" required maxlength="16" />
				<div class="login-center-input-text">密码</div>
			</div>
		</div>
		<div class="login-center clearfix">
			<div class="login-center-img"><img src="/img/ma.png"/></div>
			<div class="login-center-input last-input">
				<input type="text" name="yzmcode" placeholder="验证码" onfocus="this.placeholder=''" onblur="this.placeholder='验证码'" required maxlength="4" />
				<div class="login-center-input-text">验证码</div>
			</div>
			<div class="login-yanzheng">
				<img src="{{URL('admin/yzm/code')}}" alt="" onclick="$(this).attr('src','{{URL('admin/yzm/code')}}?'+ new Date().getTime())" />
			</div>
		</div>
		<div class="login-button" onclick="login_form()">
			登录
		</div>
	</div>
	<div class="sk-rotating-plane"></div>
</div>
<style>
.main-footer{position:absolute;width:100%;bottom:0;margin:0;}
</style>
@include('home.footer')

<!-- scripts -->
<script src="{{ asset('/js/particles.min.js') }}"></script>
<script src="{{ asset('/js/app.js') }}"></script>
<script src="{{ asset('/js/tools.js') }}"></script>
<script src="{{ asset('/layer/layer.js') }}"></script>
<script type="text/javascript">
	function login_form(){
		var username  =  $.trim($("input[name='username']").val());
		var password  =  $.trim($("input[name='password']").val());
		var yzmcode  =  $.trim($("input[name='yzmcode']").val());
		if (username == '') {
			layer.msg("请输入用户名", {icon: 2, time: 1000});
			return false;
		}
		if (password == '') {
			layer.msg("请输入密码", {icon: 2, time: 1000});
			return false;
		}
		if (yzmcode == '') {
			layer.msg("请输入验证码", {icon: 2, time: 1000});
			return false;
		}
		if (password.length < 6) {
			layer.msg("密码不能少于6位", {icon: 2, time: 1000});
			return false;
		}
		if (!puppet.checkusrandpwd(password)) {
			layer.msg("密码含有非法字符", {icon: 2, time: 1000});
			return false;
		}
		var url = "{{URL('admin/login/ajax')}}";
		var data = {username: username, password: password, yzmcode: yzmcode};
		var re = puppet.myajax('post', url, data, false);
		// console.log(re);
		if (re.code == true) {
			layer.msg(re.message, {icon:5});
			$('.login-yanzheng img').click();
			return false;
		} else {
			layer.msg("登录成功", {icon:6});
			setTimeout('window.location.href="/"', 1000);
		}
	}

	document.onkeydown = function (e) {
		var ev = document.all ? window.event : e;
		if (ev.keyCode == 13) {
			login_form();
		}
	}
</script>
</body>
</html>